//package com.santiao.youxiang.ui.adapter
//
//import android.util.Log
//import android.view.View
//import com.allen.library.shape.ShapeLinearLayout
//import com.santiao.youxiang.R
//import com.chad.library.adapter.base.BaseQuickAdapter
//import com.chad.library.adapter.base.viewholder.BaseViewHolder
//import com.chauthai.swipereveallayout.SwipeRevealLayout
//import com.santiao.youxiang.bean.Bill
//import com.santiao.youxiang.bean.YibaoBean
////import com.santiao.youxiang.database.Bill
//
////import com.santiao.youxiang.database.yibaoBill
//
//class BillAdapter(data: MutableList<YibaoBean>? = null, type: Int) :
//    BaseQuickAdapter<YibaoBean, BaseViewHolder>(R.layout.item_bill, data) {
//         var types =type
//
//    init {
//        addChildClickViewIds(R.id.ll_del) // 关键：声明子视图 ID
//    }
//
//
//    override fun convert(holder: BaseViewHolder, item: YibaoBean) {
//        // 绑定数据到视图
//        Log.e( "convert: ",types.toString())
////        var types=type
////
//
//
//        val swipeLayout = holder.getView<SwipeRevealLayout>(R.id.swipe_layout)
//        val deleteView  = holder.getView<ShapeLinearLayout>(R.id.ll_del)
//
//        // 1) 初始隐藏
//        deleteView.visibility = View.GONE
//
//
//
//        // 3) 监听滑动状态
//        swipeLayout.setSwipeListener(object : SwipeRevealLayout.SwipeListener {
//            override fun onClosed(view: SwipeRevealLayout?) {
//                deleteView.isEnabled = false
//            }
//            override fun onOpened(view: SwipeRevealLayout?) {
//                deleteView.visibility = View.VISIBLE
//                deleteView.isEnabled = true
//            }
//            override fun onSlide(view: SwipeRevealLayout?, slideOffset: Float) {
//                // 如果想滑动过程中就显示，可以在这里：
////                 deleteView.visibility = View.GONE
//                deleteView.visibility = if (slideOffset > 0f) View.VISIBLE else View.INVISIBLE
//            }
//        })
//
//
//        when(types){
//            1->{
//                when(item.billType!!.toInt()){
//                    1->{
//                        holder.setText(R.id.tv_date,item.BillDate?.substringAfter("年"))
//                        holder.setText(R.id.tv_amount,item.billAmount)
//                    }
//
//                    2->{
//                        holder.setText(R.id.tv_date,item.BillDate?.substringAfter("年"))
//                        holder.setText(R.id.tv_amount,item.billAmount)
//                        holder.setImageResource(R.id.iv_photo,R.drawable.ic_yibao_bg6)
//                        holder.setText(R.id.tv_title,"住院费")
//                    }
//
//                    3->{
//                        holder.setText(R.id.tv_date,item.BillDate?.substringAfter("年"))
//                        holder.setText(R.id.tv_amount,item.billAmount)
//                        holder.setImageResource(R.id.iv_photo,R.drawable.ic_yibao_bg7)
//                        holder.setText(R.id.tv_title,"医药费")
//                    }
//
//                    4->{
//                        holder.setText(R.id.tv_date,item.BillDate?.substringAfter("年"))
//                        holder.setText(R.id.tv_amount,item.billAmount)
//                        holder.setImageResource(R.id.iv_photo,R.drawable.ic_yibao_bg8)
//                        holder.setText(R.id.tv_title,"其他费用")
//                    }
//
//                }
//            }
//
//            2->{
//                when(item.billType!!.toInt()){
//                    1->{
//                        holder.setText(R.id.tv_date,item.BillDate?.substringAfter("年"))
//                        holder.setText(R.id.tv_amount,item.billAmount)
//                        holder.setImageResource(R.id.iv_photo,R.drawable.ic_shebao_bg5)
//                        holder.setText(R.id.tv_title,"养老保险")
//                    }
//
//                    2->{
//                        holder.setText(R.id.tv_date,item.BillDate?.substringAfter("年"))
//                        holder.setText(R.id.tv_amount,item.billAmount)
//                        holder.setImageResource(R.id.iv_photo,R.drawable.ic_shebao_bg6)
//                        holder.setText(R.id.tv_title,"生育保险")
//                    }
//
//                    3->{
//                        holder.setText(R.id.tv_date,item.BillDate?.substringAfter("年"))
//                        holder.setText(R.id.tv_amount,item.billAmount)
//                        holder.setImageResource(R.id.iv_photo,R.drawable.ic_shebao_bg7)
//                        holder.setText(R.id.tv_title,"失业保险")
//                    }
//
//                    4->{
//                        holder.setText(R.id.tv_date,item.BillDate?.substringAfter("年"))
//                        holder.setText(R.id.tv_amount,item.billAmount)
//                        holder.setImageResource(R.id.iv_photo,R.drawable.ic_shebao_bg8)
//                        holder.setText(R.id.tv_title,"工伤保险")
//                    }
//
//                }
//            }
//
//        }
//
////        holder.setText(R.id.tv_title, item.nickName)
////
////        Log.e( "convert: ","2" + item.nickName)
//        // 初始化内层 RecyclerView
////        val rvMater: RecyclerView = holder.getView(R.id.rv_mater)
////        rvMater.layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
//
////        // 设置内层适配器
////        val materialAdapter = DetailIngredientsAdapter(item.ingredients2 as MutableList<FoodSearchResbean.Ingredients>)
////        rvMater.adapter = materialAdapter
////
////        // 可选：禁用嵌套滚动（解决滑动冲突）
////        rvMater.isNestedScrollingEnabled = false
//
////        holder.setText(R.id.tv_num, item.portionSize)
//
////        var image=holder.getView<ImageView>(R.id.iv_photo)
//
////        GlideApp.with(this)        .load(R.raw.large_giphy_logo)        .into(giphyLogoView);
//
////        Glide.with(holder.itemView.context).load(item.imageUrl).into(image)
////        holder.setText(R.id.tv_content, item.content)
//
////        val radius = 15 // 半径为 20dp
////
////// 将 dp 转换为像素
////        val px = TypedValue.applyDimension(
////            TypedValue.COMPLEX_UNIT_DIP,
////            radius.toFloat(),
////            holder.itemView.context.resources.displayMetrics
////        ).toInt()
////
////        var image=holder.getView<ImageView>(R.id.iv_photo)
////
////        Glide.with(holder.itemView.context).load(item.banner)  .apply(RequestOptions.bitmapTransform(RoundedCorners(px))) .into(image)
//
//    }
//}